﻿<pfui:DialogWindow
    x:Class="VsxFactory.Modeling.StrategyManager.Dialog.PackageManagerWindow"
    x:ClassModifier="internal"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:shared="clr-namespace:Microsoft.VisualStudio.ExtensionsExplorer.UI;assembly=Microsoft.VisualStudio.ExtensionsExplorer.UI"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:self="clr-namespace:VsxFactory.Modeling.StrategyManager.Dialog"
    xmlns:resources="clr-namespace:VsxFactory.Modeling.StrategyManager"
    xmlns:pfui="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.10.0"
    xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.10.0"
    xmlns:ExtensionsExplorer="clr-namespace:Microsoft.VisualStudio.ExtensionsExplorer;assembly=Microsoft.VisualStudio.ExtensionsExplorer"
    mc:Ignorable="d"
    Background="{DynamicResource {x:Static vsfx:VsBrushes.EnvironmentBackgroundGradientKey}}"
    Title="{x:Static resources:Resources.Dialog_Title}"
    WindowStartupLocation="CenterOwner"
    HasHelpButton="True" 
    HasMaximizeButton="False"
    HasMinimizeButton="False"
    ResizeMode="CanResize"
    ShowInTaskbar="False"
    SnapsToDevicePixels="True"
    Width="900"
    Height="600"
    MinWidth="800" 
    MinHeight="450"
    Closed="OnDialogWindowClosed">

    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="CommonStyles.xaml" />
                <ResourceDictionary Source="TemplateStyles.xaml" />
                <ResourceDictionary Source="OnlineProviderTemplates.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>

    <Window.CommandBindings>
        <CommandBinding 
            Command="{x:Static self:PackageManagerWindowCommands.PackageOperationCommand}"
            CanExecute="CanExecuteCommandOnPackage"
            Executed="ExecutedPackageCommand" />

        <CommandBinding
            Command="ApplicationCommands.Close"
            Executed="ExecutedClose" />

        <CommandBinding 
            Command="{x:Static self:PackageManagerWindowCommands.ShowOptionsPage}"
            Executed="ExecutedShowOptionsPage" />

        <CommandBinding 
            Command="{x:Static self:PackageManagerWindowCommands.OpenExternalLink}"
            Executed="ExecuteOpenLicenseLink" />

        <CommandBinding
            Command="{x:Static self:PackageManagerWindowCommands.FocusOnSearchBox}"
            Executed="ExecuteSetFocusOnSearchBox" />
    </Window.CommandBindings>

    <Window.InputBindings>
        <KeyBinding Command="{x:Static self:PackageManagerWindowCommands.FocusOnSearchBox}" Gesture="CTRL+E" />
    </Window.InputBindings>

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <Border Background="{DynamicResource {x:Static vsfx:VsBrushes.NewProjectBackgroundKey}}" Padding="0,0,0,4">
            <shared:VSExtensionsExplorerCtl
                x:Name="explorer"
                ActiveView="MediumIcons"
                HorizontalAlignment="Stretch"
                SnapsToDevicePixels="True"
                ListViewIsVirtualizing="True"
                IsFxComboVisible="False"
                IsMediumIconsViewButtonVisible="False"
                IsSmallIconsViewButtonVisible="False"
                IsLargeIconsViewButtonVisible="False"
                CategorySelectionChanged="OnCategorySelectionChanged" />
        </Border>

        <Border 
            x:Name="DisclaimerText"
            Grid.Row="0"
            Width="220"
            HorizontalAlignment="Left"
            VerticalAlignment="Bottom"
            Background="White"
            BorderBrush="{DynamicResource {x:Static vsfx:VsBrushes.NewProjectBackgroundKey}}" 
            BorderThickness="0,2,0,0"
            Padding="8">
            <TextBlock 
                Text="{x:Static resources:Resources.Dialog_PackageDisclaimer}" 
                TextWrapping="Wrap" />
        </Border>

        <Grid Grid.Row="1" MinHeight="50">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <Button 
                Grid.Column="0"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                Margin="12"
                MinWidth="75" 
                MinHeight="23"
                Command="{x:Static self:PackageManagerWindowCommands.ShowOptionsPage}" 
                Content="{x:Static resources:Resources.Dialog_Settings}" />

            <Button 
                Grid.Column="1"
                HorizontalAlignment="Right"
                VerticalAlignment="Center"
                Margin="12"
                MinWidth="75" 
                MinHeight="23" 
                Command="ApplicationCommands.Close" 
                Content="{x:Static resources:Resources.Dialog_Close}" 
                IsCancel="True" />
        </Grid>
    </Grid>
</pfui:DialogWindow>

